/**
 * 
 */

/**
 * @author LJ
 *
 */
public class ProcessBookkeeping {
	private boolean m_firstResponse;
	private int m_firstResponseTime;
	private int m_waitingTime;
	private int m_turnaroundTime;
	private int m_totalCPUTime;
	
	public ProcessBookkeeping(){
		m_firstResponse = false;
		m_firstResponseTime = 0;
		m_waitingTime = 0;
		m_turnaroundTime = 0;
		m_totalCPUTime = 0;
	}

	public void update(State state) {
		switch(state){
		case READY:
			if(!this.m_firstResponse){
				++this.m_firstResponseTime;
			}
			++this.m_waitingTime;
			++this.m_turnaroundTime;
			break;
		case RUNNING:
			if(!this.m_firstResponse){
				this.m_firstResponse = true;
			}
			++this.m_totalCPUTime;
		case WAITING:
			++this.m_turnaroundTime;
		default:
			break;
		}
	}
	/**
	 * @return the m_firstResponseTime
	 */
	public int getFirstResponseTime() {
		return m_firstResponseTime;
	}

	/**
	 * @return the m_waitingTime
	 */
	public int getWaitingTime() {
		return m_waitingTime;
	}

	/**
	 * @return the m_turnaroundTime
	 */
	public int getTurnaroundTime() {
		return m_turnaroundTime;
	}

	/**
	 * @return the m_totalCPUTime
	 */
	public int getTotalCPUTime() {
		return m_totalCPUTime;
	}

}
